#include <stdio.h>
#include <stdlib.h>
/* 计算2^0 + 2^1 + 2^2 +....2^n 的和 */

int add_sum(int x)
{
	int sum = 0, temp = 1;
	int j = 0;
	while (x != 0) {
		temp = 1;
		for (j = x; j > 0; j--) {
			temp *= 2;
		}
		//printf("%d\n", temp);
		sum += temp;
		x--;
	}

	sum += 1;/* +2^0 */
	
	return sum;
}

int main(int argc, char*argv[])
{
	if (argc < 2) {
		printf("Useage: %s num\n", argv[0]);	
		exit(1);
	}
	int sum = add_sum(atoi(argv[1]));
	printf("sum = %d\n", sum);
	printf("%d\n", (char)(127 + 1));
	return 0;
}
